import Vue from 'vue'
import App from './App'
import router from './router'

import Vant from 'vant'
import 'vant/lib/index.css'
import utils from './components/UrlSearch/utils'
import VueQr from 'vue-qr'
import http from './http'
import store from '../src/store'
import qs from 'qs'
import VueEsign from 'vue-esign'
import wx from 'weixin-js-sdk'

import ElementUI from './plugins/ElementUI'

import VueTouch from 'vue-touch'
import Bridge from './config/bridge'

import {Select} from 'element-ui'

import Common from '../src/components/Common'

Vue.prototype.Common = Common
Vue.use(Select)

// 解决elementui 组件滚动带来的抖动
// Element.Dialog.props.lockScroll.default = false
Vue.prototype.$ELEMENT = { size: 'small', zIndex: 3000 }

// 腾讯云
// import TIM from 'tim-js-sdk'
// import COS from 'cos-js-sdk-v5'
// let options = {
//   SDKAppID: 1400462123
// }
// let tim = TIM.create(options)
// tim.setLogLevel(1)
// tim.registerPlugin({'cos-js-sdk': COS})
// window.tim = tim
// window.TIM = TIM
// Vue.prototype.tim = tim
// Vue.prototype.TIM = TIM
import { Circle } from 'vant';
Vue.use(Circle);

import { Collapse, CollapseItem } from 'vant';
Vue.use(Collapse);
Vue.use(CollapseItem);

import { Checkbox, CheckboxGroup } from 'vant';
Vue.use(Checkbox);
Vue.use(CheckboxGroup);

import { RadioGroup, Radio } from 'vant';
Vue.use(Radio);
Vue.use(RadioGroup);

import { Dialog } from 'vant';
Vue.use(Dialog);

Vue.prototype.$bridge = Bridge
Vue.use(VueTouch, {name: 'v-touch'})

Vue.use(wx)
Vue.use(VueEsign)
Vue.prototype.$qs = qs
Vue.use(http)
export default {
  components: {
    VueQr
  }
}
Vue.prototype.$utils = utils

Vue.use(Vant)

Vue.config.productionTip = false

// 更换网页 title
router.beforeEach((to, from, next) => {
  let show = sessionStorage.getItem('isShowtabbar')
  if (to.name === 'DoctorType') {
    to.meta.isShowtabbar = false
  } else if (show) { //  && to.meta.isShowtabbar
    to.meta.isShowtabbar = false
  }
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
